package com.lemo.dao.impl;

import com.lemo.dao.UserDao;
import com.lemo.model.User;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.io.Serializable;

import lombok.extern.slf4j.Slf4j;

/**
 * impl
 *
 * @author 方宗庆
 * @create 2018-11-06 14:52
 */
@Repository("userDao")
@Slf4j
public class UserDaoImpl implements UserDao {

  @Autowired
  private SessionFactory sessionFactory;

  @Override
  public Serializable save(User user) {
    System.out.println("sessionFactory:[" + sessionFactory.getCurrentSession() + "]");
    return sessionFactory.getCurrentSession().save(user);
  }
}